package edu.ynu.se.xiecheng.achitectureclass.nongye.dao;

import edu.ynu.se.xiecheng.achitectureclass.nongye.entity.Device;
import edu.ynu.se.xiecheng.achitectureclass.common.dao.LogicDAO;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface DeviceDAO extends LogicDAO<Device, String> {

    @Query("SELECT d FROM Device d WHERE d.greenhouseId = ?1")
    List<Device> findAllByGreenhouseId(String greenhouseId);

    @Query("SELECT d FROM Device d WHERE d.boxId = ?1")
    Device findByBoxId(String boxId);
}
